from lib.tb import *
import threading


if __name__ == '__main__':
    # for example, buy_list={'21381820676','111111','2222222'}
    buy_list={'21381820676'}

    config={
        'checkOnSaleTime': 0.1,   # every x sceonds to check is on sale 
        'username': 'timin1922',
        'password' : 'tangzhimin0122',
        'debug': True   # True, False
    }

    stream = Taobao(config)
    stream.login()
    time.sleep(1)

    # stream.buy('19306595397')
    # stream.secondKill('http://item.taobao.com/item.htm?id=21381820676', '21381820676', 1)
    for id in buy_list:
        url ='http://item.taobao.com/item.htm?id=%s' % id
        t = threading.Thread(target=stream.secondKill, args=([url, id]))
        t.start()
